package main

import (
	"strings"
)

func main() {

}

func toLowerFilename(filenames []string) (tFiles []string, err error) {
	type item struct {
		name string
		err  error
	}
	errChan := make(chan item, len(filenames))

	for _, f := range filenames {
		go func(f string) {
			var it item
			it.name, it.err = toLower(f)
			errChan <- it
		}(f)
	}

	for range filenames {
		it := <-errChan
		if it.err != nil {
			return nil, it.err
		}
		tFiles = append(tFiles, it.name)
	}

	return tFiles, nil
}

func toLower(name string) (tName string, err error) {
	return strings.ToLower(name), nil
}
